home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 80 / XENIATGM80.iso / Goodies / Blood 2 / Source / data.z / MenuSaveGame.cpp < prev    next >
C/C++ Source or Header  |  1999-04-02  |  2KB  |  73 lines

  1. // MenuSaveGame.cpp: implementation of the CMenuSaveGame class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4.  
  5. #include "LTGUIMgr.h"
  6. #include "MenuLoadGame.h"
  7. #include "MenuCommands.h"
  8. #include "BloodClientShell.h"
  9. #include "ClientRes.h"
  10.  
  11. //////////////////////////////////////////////////////////////////////
  12. // Construction/Destruction
  13. //////////////////////////////////////////////////////////////////////
  14.  
  15. CMenuSaveGame::CMenuSaveGame()
  16. {
  17.  
  18. }
  19.  
  20. CMenuSaveGame::~CMenuSaveGame()
  21. {
  22.  
  23. }
  24.  
  25. // Build the menu
  26. void CMenuSaveGame::Build()
  27. {
  28.     // Make sure to call the base class
  29.     CMenuBase::Build();
  30.  
  31.     CreateTitle("interface\\mainmenus\\savegame.pcx", IDS_MENU_TITLE_SAVEGAME, m_pMainMenus->GetTitlePos());
  32.     SetOptionPos(m_pMainMenus->GetOptionsPos());
  33.     SetItemSpacing(0);        
  34. }
  35.  
  36. // Add the menu items
  37. void CMenuSaveGame::InitSavedGameSlots()
  38. {        
  39.     // Remove all of the menu options
  40.     RemoveAllOptions();
  41.  
  42.     // Save game info
  43.     CSavedGameInfo *pSGInfo = DNULL;
  44.     pSGInfo = g_pBloodClientShell->GetSavedGameInfo();
  45.  
  46.     // Add the save game slots
  47.     if ( pSGInfo )
  48.     {
  49.         int i;
  50.         for (i=0; i < MAX_SAVESLOTS; i++)
  51.         {
  52.             HSTRING hString=m_pClientDE->CreateString(pSGInfo->gSaveSlotInfo[i].szName);
  53.             AddTextItemOption(hString, MENU_CMD_SAVE_GAME, m_pMainMenus->GetSmallFont());    
  54.             m_pClientDE->FreeString(hString);
  55.         }
  56.     }    
  57. }
  58.  
  59. DDWORD CMenuSaveGame::OnCommand(DDWORD dwCommand, DDWORD dwParam1, DDWORD dwParam2)
  60. {
  61.     switch (dwCommand)
  62.     {
  63.     case MENU_CMD_SAVE_GAME:
  64.         {
  65.             int nIndex=m_listOption.GetSelectedItem();
  66.             
  67.             // Save the saved game
  68.             g_pBloodClientShell->MenuSaveGame(nIndex);
  69.             break;
  70.         }
  71.     }
  72.     return 0;
  73. }